package com.wwwc.index.web.ejb.database;

import java.io.*;
import java.awt.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.ServletRequestWrapper;
import java.net.*;

import javax.ejb.*;
import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;

import com.wwwc.index.web.ejb.database.*;

public class DatabaseEJBQuery {
    private EJBDatabaseQuery ejbdb;

    public EJBDatabaseQuery getEJBDatabaseQuery() {
	try {
	    InitialContext initial = new InitialContext();
	    Object objref = initial.lookup("java:comp/env/ejb/DatabaseEJB");
	    EJBDatabaseQueryHome dbhome = (EJBDatabaseQueryHome)PortableRemoteObject.narrow(objref, EJBDatabaseQueryHome.class);
	    ejbdb = (EJBDatabaseQuery)dbhome.create();
	} 
	catch (RemoteException ex) {
	    return null;
	}
	catch (CreateException ex) {
	    return null;
	} 
	catch (NamingException ex) {
	    return null;
	}
	return ejbdb;
    }
}
